package com.zany.util.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
/**
 * action 父类
 * @author chengY
 * @version 1.0
 */
public abstract class AbstractActionSupport extends ActionSupport implements ServletRequestAware,Preparable,SessionAware{

	protected HttpServletRequest request;
	protected HttpServletResponse response ; 
	private static Log logger = LogFactory.getLog(AbstractActionSupport.class);
	/**
     * 重构Action的设置request方法
     * 
     * @param request
     */
    public void setServletRequest(HttpServletRequest request) {
    	this.request = request;
	}
    
    public AbstractActionSupport(){
    	if(logger.isDebugEnabled()){logger.debug("AbstractActionSupport");}
    }
    /**
     * 定义Action的获取request方法
     * 
     * @return HttpServletRequest
     */
	public HttpServletRequest getRequest() {
		return request;
	}
	
    /**
     * 定义Action设置request方法
     * 
     * @param request
     */
	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}
	/**
     * 重构Action的准备方法
     * @throws Exception  if anything is wrong, then throw exception
     */
	public void prepare() throws Exception {
		// TODO Auto-generated method stub

	}
	/**
     * 定义submit方法
     * 
     * @return  返回'success'字符串
     * @throws Exception   if anything is wrong, then throw exception
     */
	public String submit() throws Exception {
        return "success";
    }
	
    /**
     * 继承Action的输入方法
     * 
     * @return  返回'input'字符串
     * @throws Exception   if anything is wrong, then throw exception
     */
    public String input() throws Exception {
        return "input";
    }
}
